function resolveSlot(children){
    const res = {};
    for (let i=0; i<children.length; i++){
        const vnode = children[i];
        const data = vnode.data;
        if (data){
            const slotName = data.slot || 'default';
            res[slotName] = res[slotName] || [];
            res[slotName].push(vnode);
        }
    }
    return res;
}
function resolveScopeSlot(children){
    const res = {};
    for (let i=0; i<children.length; i++){
        const vnode = children[i];
        const data = vnode.data;
        if (data && data.slotScope){
            for (let scopeSlotName in data.slotScope){
                res[scopeSlotName] = res[scopeSlotName] || [];
                res[scopeSlotName].push(data.slotScope[scopeSlotName]);
            }
        }
    }
    return res;
}
export function initRender(vm){
    const $options = vm.$options;
    if (!$options._renderChildren)return;

    // vm.$slots = {
    //     default: $options._renderChildren
    // };
    vm.$slots = resolveSlot($options._renderChildren);
    vm.$scopeSlots = resolveScopeSlot($options._renderChildren);
}